import requests
url = 'https://tech.cnr.cn/techxp/'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'}
response = requests.get(url=url, headers=headers)
response.encoding = 'gbk'
result = response.text

from bs4 import BeautifulSoup
soup = BeautifulSoup(result, 'lxml')

title_tags = soup.select('span.text.kuaixun > strong')
print(title_tags)
print(len(title_tags))

url_tags = soup.select('div.item.url_http > a')
print(url_tags)
print(len(url_tags))

title_list = []
for i in title_tags:
    title = i.get_text()
    title_list.append(title)
print(title_list)

url_list = []
for i in url_tags:
    url = i.get('href')
    url_list.append(url)
print(url_list)

news_list = []
for i, j in zip(title_tags, url_tags):
    title = i.get_text()
    url = j.get('href')
    news = [title, url]
    news_list.append(news)
print(news_list)
